import {createRouter, createWebHistory} from "vue-router"
import {start, close} from "../utils/loading";
import layout from "../layout/index.vue";

const routes = [
    {
        path: '/login',
        component: () => import('../views/login/index.vue')
    },
    {
        path: '/',
        name: 'layout',
        redirect: '/home',
        component: () => import('../layout/index.vue')
    },
    //主页
    {
        path: '/',
        component: layout,
        redirect: '/home',
        meta: {name: "主页"},
        children: [
            {
                path: '/home',
                component: () => import('../views/home/index.vue'),
            }
        ]


    },
    {
        path: '/',
        component: layout,
        redirect: '/write',
        meta: {name: "写文章"},
        children: [
            {
                path: '/write',
                component: () => import('../views/write/index.vue'),
            },
            {
                path: "/grxx",
                name:"grxx",
                meta: {name:"个人信息"},
                component:()=>import("../views/grxx/index.vue")
            }
        ]
    },
    //菜单一
    {
        path: '/menu1',
        component: layout,
        redirect: '/menu1/itemOne',
        meta: {name: "内容管理"},
        children: [
            {
                path: 'itemOne',
                component: () => import('../views/write/index.vue'),
                meta: {name: "写文章"}
            },
            {
                path: 'itemTwo',
                component: () => import('../views/wzgl/index.vue'),
                meta: {name: "文章管理"}
            }
        ]


    },
    {
        path: '/menu2',
        component: layout,
        redirect: '/menu2/ysgl',
        meta: {name: "人员管理"},
        children: [
            {
                path: 'ysgl',
                component: () => import('../views/ysgl/index.vue'),
                meta: {name: "医生管理"}
            },
            {
                path: 'hzgl',
                component: () => import('../views/hzgl/index.vue'),
                meta: {name: "患者管理"}
            }
        ]


    },
    {
        path: '/menu4',
        component: layout,
        redirect: '/menu4/FilmMg',
        meta: {name: "内容管理"},
        children: [
            {
                path: 'FilmMg',
                component: () => import('../views/contentMg/FilmMg.vue'),
                meta: {name: "影像管理"}
            },
            {
                path: 'NoticeMg',
                component: () => import('../views/contentMg/NoticeMg.vue'),
                meta: {name: "通知管理"}
            },
            {
                path: 'ReportMg',
                component: () => import('../views/contentMg/ReportMg.vue'),
                meta: {name: "报告管理"}
            }
        ]


    },
    {
        path: '/menu3',
        component: layout,
        redirect: '/menu3/mzltz',
        meta: {name: "统计分析"},
        children: [
            {
                path: 'mzltz',
                component: () => import('../views/mzltz/index.vue'),
                meta: {name: "地区统计"}
            },
            {
                path: 'dzjptz',
                component: () => import('../views/dzjptz/index.vue'),
                meta: {name: "医生工作量统计"}
            },
            {
                path: 'hzmyd',
                component: () => import('../views/hzmyd/index.vue'),
                meta: {name: "影像类型统计"}
            },
            {
                path: 'jptj',
                component: () => import('../views/jptj/index.vue'),
                meta: {name: "胶片统计"}
            },
            {
                path: 'hzmyd2',
                component: () => import('../views/hzmyd2/index.vue'),
                meta: {name: "用户满意度"}
            }
        ]


    },



]

export const router = createRouter({
    history: createWebHistory(),
    routes: routes
})
router.beforeEach((to, from, next) => {
    start();
    next()
    close();
})
router.resolve((to) => {

})

export default router
